package cwb1;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;

/**
 * This class represents a sport activity.
 * 
 * @author Aurora
 *
 */
public class Sport extends Activity
{
	// A personal rate for the intensity of the sport activity
    private long intensityRate;
    
    /**
     * This method makes an sport activity object.
     * 
     * @param startDate The start date of the sport activity.
     * @param userId The userId of the user who has done the sport activity.
     */
    public Sport(Date startDate, String userId)
    {
        super(startDate, userId, ActivityFactory.SPORT);
        intensityRate = 0;
    }
    
    
    /**
     * Creates a new Sport object using the values of the Map to set the fields. Be warned, the values are never checked.
     * 
     * @param properties A Map containing the keys: for creating an activity, "intensityRate" with long.
     */
    public Sport(Map<String, Object> properties)
    {
    	super(properties);
    	setActivityType(ActivityFactory.SPORT);
    	intensityRate = (Long) properties.get("intensityRate");
    }
    
    /**
     * This method returns the properties (personal rates) of the sport activity.
     * 
     * return HashMap with the properties (personal rates) as content and the name of the properties as corresponding key.
     */
    public HashMap<String,Object> getProperties()
    {
    	HashMap<String, Object> properties = super.getProperties();
    	properties.put("intensityRate", intensityRate);
    	
    	return properties;
    }

    /**
     * This method returns the intensity rate of the sport activity.
     * 
     * @return The intensity rate of the sport activity.
     */
    public long getIntensityRate()
    {
        return intensityRate;
    }
    
    /**
     * This method changes the intensity rate of the sport activity to the given value.
     * 
     * @param value The new value for the intensity rate of the sport activity.
     */
    public void setIntensityRate(long value)
    {
        intensityRate = value;
    }
    
    
}
